<div class="page-wrapper d-flex flex-column pt-4">
    <div class="container-xl">
        <div class="page-header d-print-none">
            <div class="row align-items-center">
                <div class="col">
                    <div class="page-pretitle">
                        Create
                    </div>
                    <h3 class="page-title">
                        New User
                    </h3>
                </div>
            </div>
        </div>
    </div>
    <div class="page-body d-flex flex-row-reverse">


        <aside class="bd-sidebar sub-sidebar" ng-if="activedUser">
            <nav class="bd-links p-3" aria-label="Sub-section navigation">
                <div class="card card-body">
                    <actions preview-url="activedUser.user.fullPath" back-url="'/portal/user/list'"></actions>
                </div>
            </nav>
        </aside>

        <!-- ----------------------------------------------------------- -->

        <div class="content-body py-3 pe-3">
            <!-- Main content -->
            <section class="" ng-init="loadMyProfile()">
                <form ng-if="activedUser" ng-if="activedUser" ng-class="{'submitted': submitted}"
                    ng-submit="saveUser(activedUser)">
                    <div class="card card-body mb-4">

                        <div class="mb-3">
                            <label class="form-label">Username</label>
                            <input type="text" class="form-control form-control-lg"
                                ng-model="activedUser.user.userName" />
                        </div>
                        <div class="mb-3">
                            <label class="form-label">Email</label>
                            <input type="text" class="form-control" ng-model="activedUser.user.email" />
                        </div>
                        <div class="row">
                            <div class="col mb-3">
                                <label class="form-label">First Name</label>
                                <input type="text" class="form-control" ng-model="activedUser.user.firstName" />
                            </div>
                            <div class="col mb-3">
                                <label class="form-label">Last Name</label>
                                <input type="text" class="form-control tags" ng-model="activedUser.user.lastName" />
                            </div>
                        </div>

                        <div class="row">
                            <div class="col mb-3">
                                <span class="form-check form-switch">
                                    <input type="checkbox" ng-model="activedUser.user.isChangePassword"
                                        id="isChangePassword"
                                        class="form-check-input ng-pristine ng-untouched ng-valid ng-empty" />
                                    <label class="form-check-label mb-0" for="isChangePassword">
                                        <span>Change Password</span>
                                    </label>
                                </span>
                            </div>
                            <div class="col mb-3" ng-if="activedUser.user.isChangePassword">
                                <label class="form-label">Current Password</label>
                                <input type="password" class="form-control"
                                    ng-model="activedUser.user.changePassword.currentPassword" />
                            </div>
                            <div class="col mb-3" ng-if="activedUser.user.isChangePassword">
                                <label class="form-label">New Password</label>
                                <input type="password" class="form-control tags"
                                    ng-model="activedUser.user.changePassword.newPassword" />
                            </div>
                        </div>

                        <label class="form-label">Active roles</label>
                        <div ng-if="isInRole('SuperAdmin')" class="tab-pane" ng-if="activedUser.userRoles.length>0">
                            <navs data="activedUser.userRoles" callback="updateRoleStatus(nav)"></navs>
                        </div>
                    </div>

                    <div class="row">
                        <additional-value ng-if="activedUser" class="mb-4" additional-data="activedUser.userData"
                            database-name="'sys_user_data'" parent-type="'User'" parent-id="activedUser.id">
                        </additional-value>
                    </div>

                </form>
            </section>
            <!-- /.content -->
        </div>

    </div>
</div>